﻿Public Class frmLogin

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Close()
    End Sub

    Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
        Dim sql As String = "select * from USERS where Username = '" & txtUserName.Text &
                            "' and Password = '" & txtPassword.Text & "'"
        Dim GetDT As DataProvider = New DataProvider
        Dim reader As SqlClient.SqlDataReader = GetDT.SQL_ExcuteQueryReader(sql)
        If reader.HasRows Then
            Dim frm As frmMain = New frmMain
            frm.Show()
        Else
            Label4.Text = "Đăng nhập thất bại, vui lòng kiểm tra lại Username và Password"
        End If
    End Sub

    Private Sub btnCancel_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.Close()
    End Sub
End Class
